import { ObjCreate } from "../ObjCreate";
import { ResFileConst } from "../../../resource/ResFileConst";
import { LoaderHelp } from "../../../../common/display/LoaderHelp";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../resource/ImagesConst";
import { GLoadedButton } from "../../../../../com/mui/controls/GLoadedButton";
//class MountBattleButton
    
    export  class MountBattleButton /* flash.display.Sprite */
    {
        constructor()
        {
            
            this.initView();
            return;
        }

        /* internal  */initView(): void
        {
            this._battleBtn = ObjCreate.createGLoadedButton(ResFileConst.Battle, 0, 0, 78, 78, this);
            this._battleLabelBitmap = new Object /* flash.display.Bitmap */();
            this._battleLabelBitmap.x = 15;
            this._battleLabelBitmap.y = 25;
            addChild(this._battleLabelBitmap);
            return;
        }

        public set isBattle(arg1: Boolean)
        {
            this._isBattle = arg1;
            LoaderHelp.addResCallBack(ResFileConst.mountBattle, this.updateBitmap);
            return;
        }

        public get isBattle(): Boolean
        {
            return this._isBattle;
        }

        public updateBitmap(): void
        {
            if (this._isBattle) 
            {
                this._battleLabelBitmap.bitmapData = GlobalClass.getBitmapData(ImagesConst.mountPuton);
            }
            else 
            {
                this._battleLabelBitmap.bitmapData = GlobalClass.getBitmapData(ImagesConst.mountPutoff);
            }
            return;
        }

        /* internal */ /* var */_battleBtn: GLoadedButton;

        /* internal */ /* var */_battleLabelBitmap: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_isBattle: Boolean;
    }
